package com.joysuch.wwyt.mh.bean;

import com.joysuch.wwyt.core.common.util.DateTimeUtil;
import com.joysuch.wwyt.mh.entity.MhAlarmMessage;
import com.joysuch.wwyt.risk.entity.RiskEvaluationAlarmMesage;
import lombok.Data;

import java.time.LocalDate;

/**
 * @Author ZhangDong
 * @Date 2020/5/22 16:53
 */
@Data
public class AlarmSummaryBean {

    // 状态 0：报警中 1：已经恢复正常范围 2：已处理
    private Integer state;

    // 报警时间
    private LocalDate alarmTime;

    public AlarmSummaryBean() {
    }

    public AlarmSummaryBean(MhAlarmMessage mhAlarmMessage) {
        this.state = mhAlarmMessage.getState();
        this.alarmTime = mhAlarmMessage.getAlarmTime().toLocalDate();
    }

    public AlarmSummaryBean(RiskEvaluationAlarmMesage riskEvaluationAlarmMesage) {
        this.state = riskEvaluationAlarmMesage.getState();
        this.alarmTime = DateTimeUtil.date2LocalDateTime(riskEvaluationAlarmMesage.getCreateTime()).toLocalDate();
    }
}
